package com.withouther.robot.rainingrobot.util.ai.asr.listener;

import com.withouther.robot.rainingrobot.util.ai.asr.model.MessageChange;

import java.nio.ByteBuffer;

public interface ConnectionListener {

    /**
     * Invoked once the connection to the remote URL has been established.
     */
    void onOpen();

    /**
     * Invoked after the connection was closed.
     *
     * @param closeCode the RFC 6455 status code
     * @param reason    a string description for the reason of the close
     */
    void onClose(int closeCode, String reason);

    /**
     * Invoked on arrival of a text message.
     *
     * @param message the text message.
     */
    void onMessage(String message);

    /**
     * Invoked on arrival of a binary message.
     *
     * @param message the binary message.
     */
    void onMessage(ByteBuffer message);

    /**
     * 字字返回方法
     *
     * @param message the binary message.
     */
    void onMessageChange(MessageChange message);

}
